package model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 *
 * User of Moodle site.
 * 
 * @author Sergey Nikonenko
 */


public class MoodleUser {
     private long id;
     private String fullname;
     private String password;
     private String username;
     private String firstname;
     private String lastname;
     private String email;
     private String address;
     private String phone1;
     private String phone2;
     private String icq;
     private String skype;
     private String yahoo;
     private String iam;
     private String msn;
     private String department;
     private String institution;
     private String idnumber;
     private String interests;
     private long firstaccess;
     private long lastaccess;
     private String auth;
     private long confirmed;
     private String lang;
     private String calendartype;
     private String theme;
     private String timezone;
     private long mailformat;
     private String description;
     private long descriptionformat;
     private String city;
     private String url;
     private String country;
     private String firstnamephonetic;
     private String lastnamephonetic;
     private String midlename;
     private String alternatename;
     private String profileimageurlsmall;
     private String profileimageurl;
     private Set<UserCustomField> usercustomfields = new HashSet<UserCustomField>();
     private Set<UserPreference> userpreferences = new HashSet<UserPreference>();
     private Set<UserEnrolledCourse> userenrolledCourses = new HashSet<UserEnrolledCourse>();
     
     public MoodleUser(){
     }
 
     public MoodleUser(long id, String password, String username, String firstname, String lastname, String email, String address, String phone1, String phone2, String icq, String skype, String yahoo, String iam, String msn, String department, String institution, String idnumber, String interests, long firstaccess, long lastaccess, String auth, long confirmed, String lang, String calendartype, String theme, String timezone, long mailformat, String description, long descriptionformat, String city, String url, String country, String firstnamephonetic, String lastnamephonetic, String midlename, String alternatename, String profileimageurlsmall, String profileimageurl,Set<UserCustomField> usercustomfields, Set<UserPreference> userpreferences) {
        this.id = id;
        this.password = password;
        this.username = username;
        this.firstname = firstname;
        this.lastname = lastname;
        this.email = email;
        this.address = address;
        this.phone1 = phone1;
        this.phone2 = phone2;
        this.icq = icq;
        this.skype = skype;
        this.yahoo = yahoo;
        this.iam = iam;
        this.msn = msn;
        this.department = department;
        this.institution = institution;
        this.idnumber = idnumber;
        this.interests = interests;
        this.firstaccess = firstaccess;
        this.lastaccess = lastaccess;
        this.auth = auth;
        this.confirmed = confirmed;
        this.lang = lang;
        this.calendartype = calendartype;
        this.theme = theme;
        this.timezone = timezone;
        this.mailformat = mailformat;
        this.description = description;
        this.descriptionformat = descriptionformat;
        this.city = city;
        this.url = url;
        this.country = country;
        this.firstnamephonetic = firstnamephonetic;
        this.lastnamephonetic = lastnamephonetic;
        this.midlename = midlename;
        this.alternatename = alternatename;
        this.profileimageurlsmall = profileimageurlsmall;
        this.profileimageurl = profileimageurl;
        this.usercustomfields = usercustomfields;
        this.userpreferences = userpreferences;
    }
    /**
     * Конструктор использующийся при создании нового пользователя.
     */
    public MoodleUser(String password, String username, String firstname, String lastname, String email, String idnumber, String auth, String lang, String calendartype, String theme, String timezone, long mailformat, String description, String city, String country, String firstnamephonetic, String lastnamephonetic, String midlename, String alternatename, Set<UserCustomField> usercustomfields, Set<UserPreference> userpreferences ) {
        this.password = password;
        this.username = username;
        this.firstname = firstname;
        this.lastname = lastname;
        this.email = email;
        this.idnumber = idnumber;
        this.auth = auth;
        this.lang = lang;
        this.calendartype = calendartype;
        this.theme = theme;
        this.timezone = timezone;
        this.mailformat = mailformat;
        this.description = description;
        this.city = city;
        this.country = country;
        this.firstnamephonetic = firstnamephonetic;
        this.lastnamephonetic = lastnamephonetic;
        this.midlename = midlename;
        this.alternatename = alternatename;
        this.usercustomfields = usercustomfields;
        this.userpreferences = userpreferences;
    }
    
     /**
     * Конструктор объектов, которые возвращаются методом createUsers.
     */
    public MoodleUser(long id, String username) {
        this.id = id;
        this.username = username;
    }
/**
     * Used for JSON response wrapping in to the MoodleUser object 
     * in Set<MoodleUser> getUsers(Map<String, String> criteria) method.
     */
    public MoodleUser(long id, String username, String firstname, String lastname, String fullname, String email, String department, String idnumber, long firstaccess, long lastaccess, String description, long descriptionformat, String city, String country, String profileimageurlsmall, String profileimageurl) {
        this.id = id;
        this.username = username;
        this.firstname = firstname;
        this.lastname = lastname;
        this.fullname = fullname;
        this.email = email;
        this.department = department;
        this.idnumber = idnumber;
        this.firstaccess = firstaccess;
        this.lastaccess = lastaccess;
        this.description = description;
        this.descriptionformat = descriptionformat;
        this.city = city;
        this.country = country;
        this.profileimageurlsmall = profileimageurlsmall;
        this.profileimageurl = profileimageurl;
    }
 
     public MoodleUser(long id, String username, String firstname, String lastname, String email, String idnumber,  String auth)  {
        this.id = id;
        this.username = username;
        this.firstname = firstname;
        this.lastname = lastname;
        this.email = email;
        this.idnumber = idnumber;
        this.auth = auth;
        
    }
     
    /**
     * ID of the user.
     * 
     * @return the id
     */
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }

     /**
     * Fullname of the user.
     * 
     * @return the fullname
     */
    public String getFullname() {
        return fullname;
    }

  
    public void setFullname(String fullname) {
        this.fullname = fullname;
    }
    /**
     * Plain text password consisting of any characters.
     * 
     * @return the password
     */
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * Username policy is defined in Moodle security config.
     * 
     * @return the username
     */
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * The first name(s) of the user.
     * 
     * @return the firstname
     */
    public String getFirstname() {
        return firstname;
    }
    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    /**
     * The family name of the user.
     * 
     * @return the lastname
     */
    public String getLastname() {
        return lastname;
    }
    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    /**
     * A valid and unique email address.
     * 
     * @return the email
     */
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * Postal address.
     * 
     * @return the address
     */
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * Phone 1.
     * 
     * @return the phone1
     */
    public String getPhone1() {
        return phone1;
    }
    public void setPhone1(String phone1) {
        this.phone1 = phone1;
    }

    /**
     * Phone 2.
     * 
     * @return the phone2
     */
    public String getPhone2() {
        return phone2;
    }
    public void setPhone2(String phone2) {
        this.phone2 = phone2;
    }

    /**
     * Icq number.
     * 
     * @return the icq
     */
    public String getIcq() {
        return icq;
    }
    public void setIcq(String icq) {
        this.icq = icq;
    }

    /**
     * Skype id.
     * 
     * @return the skype
     */
    public String getSkype() {
        return skype;
    }
    public void setSkype(String skype) {
        this.skype = skype;
    }

    /**
     * Yahoo id.
     * 
     * @return the yahoo
     */
    public String getYahoo() {
        return yahoo;
    }
    public void setYahoo(String yahoo) {
        this.yahoo = yahoo;
    }

    /**
     * Aim id.
     * 
     * @return the iam
     */
    public String getIam() {
        return iam;
    }
    public void setIam(String iam) {
        this.iam = iam;
    }

    /**
     * Msn number.
     * 
     * @return the msn
     */
    public String getMsn() {
        return msn;
    }
    public void setMsn(String msn) {
        this.msn = msn;
    }

    /**
     * Department.
     * 
     * @return the department
     */
    public String getDepartment() {
        return department;
    }
    public void setDepartment(String department) {
        this.department = department;
    }

    /**
     * Institution.
     * 
     * @return the institution
     */
    public String getInstitution() {
        return institution;
    }
    public void setInstitution(String institution) {
        this.institution = institution;
    }

    /**
     * An arbitrary ID code number perhaps from the institution.
     * 
     * @return the idnumber
     */
    public String getIdnumber() {
        return idnumber;
    }
    public void setIdnumber(String idnumber) {
        this.idnumber = idnumber;
    }

    /**
     * User interests (separated by commas).
     * 
     * @return the interests
     */
    public String getInterests() {
        return interests;
    }
    public void setInterests(String interests) {
        this.interests = interests;
    }

    /**
     * First access to the site (0 if never).
     * 
     * @return the firstaccess
     */
    public long getFirstaccess() {
        return firstaccess;
    }
    public void setFirstaccess(long firstaccess) {
        this.firstaccess = firstaccess;
    }

    /**
     * Last access to the site (0 if never).
     * 
     * @return the lastaccess
     */
    public long getLastaccess() {
        return lastaccess;
    }
    public void setLastaccess(long lastaccess) {
        this.lastaccess = lastaccess;
    }

    /**
     * Auth plugins include manual, ldap, imap, etc.
     * 
     * @return the auth
     */
    public String getAuth() {
        return auth;
    }
    public void setAuth(String auth) {
        this.auth = auth;
    }

    /**
     * Active user: 1 if confirmed, 0 otherwise.
     * 
     * @return the confirmed
     */
    public long getConfirmed() {
        return confirmed;
    }
    public void setConfirmed(long confirmed) {
        this.confirmed = confirmed;
    }

    /**
     * Language code such as "en", must exist on server.
     * 
     * @return the lang
     */
    public String getLang() {
        return lang;
    }
    public void setLang(String lang) {
        this.lang = lang;
    }

    /**
     * Calendar type such as "gregorian", must exist on server.
     * 
     * @return the calendartype
     */
    public String getCalendartype() {
        return calendartype;
    }
    public void setCalendartype(String calendartype) {
        this.calendartype = calendartype;
    }

    /**
     * Theme name such as "standard", must exist on server.
     * 
     * @return the theme
     */
    public String getTheme() {
        return theme;
    }
    public void setTheme(String theme) {
        this.theme = theme;
    }

    /**
     * Timezone code such as Australia/Perth, or 99 for default.
     * 
     * @return the timezone
     */
    public String getTimezone() {
        return timezone;
    }
    public void setTimezone(String timezone) {
        this.timezone = timezone;
    }

    /**
     * Mail format code is 0 for plain text, 1 for HTML etc.
     * 
     * @return the mailformat
     */
    public long getMailformat() {
        return mailformat;
    }
    public void setMailformat(long mailformat) {
        this.mailformat = mailformat;
    }

    /**
     * User profile description.
     * 
     * @return the description
     */
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * Description format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN).
     * 
     * @return the descriptionformat
     */
    public long getDescriptionformat() {
        return descriptionformat;
    }
    public void setDescriptionformat(long descriptionformat) {
        this.descriptionformat = descriptionformat;
    }

    /**
     * Home city of the user.
     * 
     * @return the city
     */
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }

    /**
     * URL of the user.
     * 
     * @return the url
     */
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }

    /**
     * Home country code of the user, such as AU or CZ.
     * 
     * @return the country
     */
    public String getCountry() {
        return country;
    }
    public void setCountry(String country) {
        this.country = country;
    }

    /**
     * The first name(s) phonetically of the user.
     * 
     * @return the firstnamephonetic
     */
    public String getFirstnamephonetic() {
        return firstnamephonetic;
    }
    public void setFirstnamephonetic(String firstnamephonetic) {
        this.firstnamephonetic = firstnamephonetic;
    }

    /**
     * The family name phonetically of the user.
     * 
     * @return the lastnamephonetic
     */
    public String getLastnamephonetic() {
        return lastnamephonetic;
    }
    public void setLastnamephonetic(String lastnamephonetic) {
        this.lastnamephonetic = lastnamephonetic;
    }

    /**
     * The middle name of the user.
     * 
     * @return the midlename
     */
    public String getMidlename() {
        return midlename;
    }
    public void setMidlename(String midlename) {
        this.midlename = midlename;
    }

    /**
     * The alternate name of the user.
     * 
     * @return the alternatename
     */
    public String getAlternatename() {
        return alternatename;
    }
    public void setAlternatename(String alternatename) {
        this.alternatename = alternatename;
    }

    /**
     * User image profile URL - small version.
     * 
     * @return the profileimageurlsmall
     */
    public String getProfileimageurlsmall() {
        return profileimageurlsmall;
    }
    public void setProfileimageurlsmall(String profileimageurlsmall) {
        this.profileimageurlsmall = profileimageurlsmall;
    }

    /**
     * User image profile URL - big version.
     * 
     * @return the profileimageurl
     */
    public String getProfileimageurl() {
        return profileimageurl;
    }
    public void setProfileimageurl(String profileimageurl) {
        this.profileimageurl = profileimageurl;
    }

    /**
     * User custom fields (also known as user profile fields).
     * 
     * @return the customfields
     */
    public Set<UserCustomField> getCustomfields() {
        return usercustomfields;
    }
    public void setCustomfields(Set<UserCustomField> usercustomfields) {
        this.usercustomfields = usercustomfields;
    }

    /**
     * Users preferences.
     * 
     * @return the userpreferences
     */
    public Set<UserPreference> getUserpreferences() {
        return userpreferences;
    }
    public void setUserpreferences(Set<UserPreference> userpreferences) {
        this.userpreferences = userpreferences;
    }

    /**
     * Courses where the user is enrolled - limited by which 
     * courses the user is able to see.
     * 
     * @return the userenrolledCourses
     */
    public Set<UserEnrolledCourse> getUserenrolledCourses() {
        return userenrolledCourses;
    }
    public void setUserenrolledCourses(Set<UserEnrolledCourse> userenrolledCourses) {
        this.userenrolledCourses = userenrolledCourses;
    }

    @Override
    public String toString() {
        return "MoodleUser{" + "id=" + id + ", password=" + password + ", username=" + username + ", firstname=" + firstname + ", lastname=" + lastname + ", email=" + email + ", address=" + address + ", phone1=" + phone1 + ", phone2=" + phone2 + ", icq=" + icq + ", skype=" + skype + ", yahoo=" + yahoo + ", iam=" + iam + ", msn=" + msn + ", department=" + department + ", institution=" + institution + ", idnumber=" + idnumber + ", interests=" + interests + ", firstaccess=" + firstaccess + ", lastaccess=" + lastaccess + ", auth=" + auth + ", confirmed=" + confirmed + ", lang=" + lang + ", calendartype=" + calendartype + ", theme=" + theme + ", timezone=" + timezone + ", mailformat=" + mailformat + ", description=" + description + ", descriptionformat=" + descriptionformat + ", city=" + city + ", url=" + url + ", country=" + country + ", firstnamephonetic=" + firstnamephonetic + ", lastnamephonetic=" + lastnamephonetic + ", midlename=" + midlename + ", alternatename=" + alternatename + ", profileimageurlsmall=" + profileimageurlsmall + ", profileimageurl=" + profileimageurl + ", usercustomfields=" + usercustomfields + ", userpreferences=" + userpreferences + ", userenrolledCourses=" + userenrolledCourses + '}';
    }

  

  
        
}
